home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / DevTools / eText5 / Source / unused4Code / BBC.bproj / BBCUI.m < prev    next >
Encoding:
Text File  |  1994-07-24  |  3.0 KB  |  118 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //    FILENAME:    BBCUI.m 
  3. //    SUMMARY:    User Interface for a Billiard-Ball Computation Annotation
  4. //    SUPERCLASS:    Object
  5. //    INTERFACE:    BBCUI
  6. //    PROTOCOLS:    <Inspectable>
  7. //    AUTHOR:        Rohit Khare
  8. //    COPYRIGHT:    (c) 1994 California Institure of Technology, eText Project
  9. ///////////////////////////////////////////////////////////////////////////////
  10. //    DESCRIPTION
  11. //        Implementation of a shared inspector for BBCs
  12. //        Separated out controller from old BilliardView code.
  13. ///////////////////////////////////////////////////////////////////////////////
  14. //    HISTORY
  15. //    05/29/94:    Created.
  16. ///////////////////////////////////////////////////////////////////////////////
  17.  
  18. #import "BBC.h"
  19. #define    CONT    "Controls"
  20.  
  21. @implementation BBCUI
  22. //    id    fileWell;
  23. //    id    nameField;
  24. //    id    accelSwitch;
  25. //    id  editSwitch;
  26. //    id  pathSwitch;
  27. //    id  fwdButton;
  28. //    id  backButton;
  29. //    id    hresField;
  30. //    id    vresField;
  31. //    id    bbcPanel;
  32. //    id    bbcView;
  33. //    id    theBBC;
  34.  
  35. + new
  36. {
  37.     static BBCUI *bbcui = nil;
  38.     
  39.     if (!bbcui) {
  40.         bbcui = [[BBCUI alloc] init];
  41.     }
  42.     return bbcui;
  43. }
  44. - init
  45. {
  46.     char        buf[MAXPATHLEN];
  47.     NXBundle   *bundle;
  48.     
  49.     [super init];
  50.     bundle = [NXBundle bundleForClass:[BBCUI class]];
  51.     if ( [bundle getPath:buf forResource:"BBCUI" ofType:"nib"] ) {
  52.         [NXApp loadNibFile:buf owner:self withNames:NO];
  53.     } else {
  54.         NXLogError("NIB not found: BBCUI");
  55.     }
  56.     bbcView = [bbcPanel contentView];
  57.     [fwdButton setPeriodicDelay:0 andInterval:0.2];
  58.     [backButton setPeriodicDelay:0 andInterval:0.2];
  59.     return self;
  60. }
  61. - free {return self;}
  62. - (const NXAtom *) types:sender
  63. {
  64.     static NXAtom types[2] = {NULL, NULL};
  65.     
  66.     if (!types[0]) {
  67.         types[0] = NXUniqueString(CONT);
  68.     }
  69.     return types;
  70. }
  71.  
  72. - (char *) inspectorTitle
  73. {
  74.     return (char *) NXUniqueString("Billiard-Ball Computation");
  75. }
  76.  
  77. - resignInspector: (View *) oldInspector ofType: (char *) type :sender
  78. {
  79.     return self;
  80. }
  81.  
  82. - activateInspector: (View *) newInspector ofType: (char *) type :sender
  83. {
  84.     return self;
  85. }
  86.  
  87. - inspectorForType:(char *) type :sender
  88. {
  89.     if(!strcmp(type,CONT))
  90.         return bbcView;
  91.     else NXLogError("Massive Inspector Failure: Asked BBCUI for: %s", type);
  92.     return bbcView;
  93. }
  94.  
  95. - setName:sender {[theBBC setName:NXUniqueString([sender stringValue])]; return self;}
  96. - setShowPath:sender {[theBBC setShowPath:[pathSwitch state]]; return self;}
  97. - setAccelerated:sender {[theBBC setAccelerated:![accelSwitch state]]; return self;}
  98. - setEditable:sender {[theBBC setEditable:[editSwitch state]]; return self;}
  99. - clickFwd:sender{[theBBC stepForward]; return self;}
  100. - clickBack:sender{[theBBC stepBackward]; return self;}
  101. - setRes:sender{[theBBC setRes:[hresField intValue] :[vresField intValue]]; return self;}
  102. - setBBC:newBBC
  103. {
  104.     theBBC = newBBC;
  105.     return [self load];
  106. }
  107. - bbc {return theBBC;}
  108. - load
  109. {
  110.     [nameField setStringValue:[theBBC name]];
  111.     [accelSwitch setState:![theBBC isAccelerated]];
  112.     [pathSwitch setState:[theBBC doesShowPath]];
  113.     [editSwitch setState:[theBBC isEditable]];
  114.     [hresField setIntValue:[theBBC hres]];
  115.     [vresField setIntValue:[theBBC vres]];
  116.     return self;
  117. }
  118. @end